#include <iostream>
#include <memory>
#include <string>
#include <sstream>
#include <jsoncpp/json/json.h>

int main()
{
  const char* name= "小明";
  int age = 18;
  float score[]={80.0,75.5,91.9};

  Json::Value val;
  val["姓名"] = name;
  val["年龄"] = age;
  val["成绩"].append(score[0]);
  val["成绩"].append(score[1]);
  val["成绩"].append(score[2]);
  Json::StreamWriterBuilder swb;
  std::unique_ptr<Json::StreamWriter> sw(swb.newStreamWriter());
  std::stringstream ss;
  sw->write(val,&ss);
  std::cout << ss.str() <<std::endl;

  return 0;
}
